import java.util.*;

public class Hash {

    public int[] twoSum(int[] nums, int target) {
        Map<Integer, Integer> hash = new HashMap<>();
        for(int i = 0; i < nums.length; i++){
            int x = target - nums[i];
            if(hash.containsKey(x)){
                return new int[]{i, hash.get(x)};
            }
            hash.put(nums[i], i);
        }
        return new int[]{-1, -1};
    }



}
